import { useState } from 'react';
import './index.css'
function Color(props) {
    const [indexs, setIndex] = useState([0])
    const handType = (index) => {
        setIndex(index)
    }
    return (
        <>
            {
                props.type.map((item, index) => {
                    return (
                        <button key={index} className={indexs == index ? "active" : ''} onClick={() => handType(index)}>{item}</button>
                    )
                })
            }
        </>
    )
}
export default Color;